#include <amxmodx>
#include <amxmisc>
#include <dprp2>
#include <engine>

new g_Model[] = "models/mecklenburg/banker.mdl"

public plugin_init()
{
	register_plugin("DPRP - NPCs","1.0","Hawk552")
	
	register_clcmd("createnpc","CreateNpc")
	
	register_clcmd("getweap","GetWeap")
	
	register_clcmd("registerhelp","Registerhelp")
}

public plugin_precache()
{
	precache_model(g_Model)
	
	register_cvar("blah","0")
	
	server_print("Result of register: %d",DPRP_RegisterNpc("Explosive Person",Float:{-804.0,2158.0,-147.0},0.0,g_Model,"NpcHandler"))
	
	server_print("Result of item register: %d %d %d",DPRP_RegisterItem("Diarrhea","ItemHandler","Explosive",0),DPRP_RegisterItem("The Internet","ItemHandler","Very internetish",0),DPRP_RegisterItem("Explosive Diarrhea","ItemHandler","VERY explosive",0))
	
	DPRP_RegisterItem("EXPLOSIVE EXPLOSION","ItemHandler","VERY VERY EXPLOSIVE",1)
	DPRP_RegisterItem("ATM Card","ItemHandler","Allows you to withdraw/deposit money at an ATM machine.",0)
	
	DPRP_RegisterItem("Steak","SteakHandle","Delicious, beef",1)
	
	DPRP_RegisterItem("Restricted License","Handler","Allows you to possess and acquisition restricted firearms.",0)
	//DPRP_RegisterItem("Glock18",7,"Glock18","Handgun, 9mm, Restricted",1)
}

public ItemHandler(id,ItemId)
{
	client_print(id,print_chat,"[DPRP] You have used item %d.",ItemId)
}

public CreateNpc(id)
{
	new Origin[3],Float:vOrigin[3]
	get_user_origin(id,Origin,3)
	
	IVecFVec(Origin,vOrigin)
	
	DPRP_RegisterNpc("Extra Explosive Person",vOrigin,random_float(0.0,360.0),g_Model,"Handler")
}

public NpcHandler(id,Ent)
	client_print(id,print_chat,"[DPRP] You are talking to this NPC, or something. Ent is %d.",Ent)
	
public Handler(id,Ent)
{
	client_print(id,print_chat,"[DPRP] You are talking to this NPC, or something. Ent is %d.",Ent)
	
	return
}

public SteakHandle(id,ItemId)
{
	client_print(id,print_chat,"[DPRP] You have eaten the steak.")
	
	DPRP_SetUserHunger(id,DPRP_GetUserHunger(id) - 20)
}

public GetWeap(id)
{
}

public Registerhelp(id)
{
	new Arg1[32],Arg2[64]
	read_argv(1,Arg1,31)
	read_argv(2,Arg2,63)
	
	DPRP_AddCommand(Arg1,Arg2)
}

public DPRP_BuyProperty(id,Index,Targetname[])
	client_print(0,print_chat,"%d has bought door id %d targetname %s",id,Index,Targetname)

public DPRP_UserRob(id)
{
	if(get_cvar_num("blah"))
	{
		client_print(id,print_chat,"Halting")
		return PLUGIN_HANDLED
	}
	
	return PLUGIN_CONTINUE
}

public DPRP_RobEnd(id,msg[])
	client_print(id,print_chat,"Rob ended due to %s",msg)
